﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using HZ.Supervise.IBLL;
using HZ.Supervise.Model;

namespace HZ.Supervise.Web.Common
{
    public partial class logindex : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //判断登录有效性
            IBLL_Login il = HZ.Supervise.BLLFactory.BLL_Login();
            User user = new User();
            user = CurrentAccount.GetUser();
            string str = "";
            if (user.UserRole.RoleID == "03")//中心账户
            {
                string AccountEncrypt = new HZ.SinglePointLogin.RedirectHelper().EncryptUrlString(CurrentAccount.GetUser().UserID, System.Configuration.ConfigurationManager.AppSettings["connectkey"]);//加密用户名
                string PwdEncrypt = new HZ.SinglePointLogin.RedirectHelper().EncryptUrlString(CurrentAccount.GetUser().UserPassword, System.Configuration.ConfigurationManager.AppSettings["connectkey"]);//加密密码
                string url = string.Format(CurrentAccount.URL_INDEXPAGE, AccountEncrypt, PwdEncrypt);
                CurrentAccount.Logout();//当前用户登出
                str = "window.top.location='" + url + "'";
            }
            else
            {
                HZ.Web.WebUtil.Alert("用户类型不能进行系统切换！", this);
            }
            Response.Write(HZ.Web.WebUtil.GetScript(str));
        }
    }
}
